<template>
  <div style="margin-top: 20px">
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="page"
      :page-sizes="[1, 2, 10, 50, 100]"
      :page-size="limit"
      layout="total, sizes, prev, pager, next, jumper"
      :total="total"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  data() {
    return {
      page: 1,
      limit: 2,
    }
  },
  props: {
    total: {
      type: Number,
      default: 0,
    },
  },

  methods: {
    handleCurrentChange(page) {
      this.$emit('change', {
        page: page,
        limit: this.limit,
      })
    },
    handleSizeChange(limit) {
      this.$emit('change', {
        page: this.page,
        limit: limit,
      })
    },
  },
}
</script>